let fs=require('fs')
let path=require('path')

let data=require('./data.js')

fn(data,__dirname)
function fn(data,flidpath){
    // 遍历
    data.forEach(item=>{
        // 拼接
        let newp=path.join(flidpath,item.name||item);
        // 判断有没有后缀名
        if(path.extname(newp)){
            fs.writeFileSync(newp,'')
        }else{
            if(!fs.existsSync(newp)){
                fs.mkdirSync(newp)
            }
            item.chlid&&fn(data,item.chlid)
        }
    })
}